import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '测试阶段',
    align: "center",
    dataIndex: 'testStageName'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status',
    customRender:({text}) => {
       return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}]);
     },
  },
  {
    title: '排序',
    align: "center",
    sorter: true,
    dataIndex: 'sortOrder'
  },
  {
    title: '描述',
    align: "center",
    dataIndex: 'description'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建时间',
    align: "center",
    sorter: true,
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '更新时间',
    align: "center",
    sorter: true,
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "测试阶段",
    field: 'testStageName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'status',
    component: 'JSwitch',
    componentProps:{
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '测试阶段',
    field: 'testStageName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入测试阶段!'},
             ];
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JSwitch',
    componentProps:{
    },
  },
  {
    label: '排序',
    field: 'sortOrder',
    component: 'InputNumber',
  },
  {
    label: '描述',
    field: 'description',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  testStageName: {title: '测试阶段',order: 0,view: 'text', type: 'string',},
  status: {title: '状态',order: 1,view: 'switch', type: 'string',},
  sortOrder: {title: '排序',order: 2,view: 'number', type: 'number',},
  description: {title: '描述',order: 3,view: 'textarea', type: 'string',},
  createBy: {title: '创建人',order: 4,view: 'text', type: 'string',},
  createTime: {title: '创建时间',order: 5,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 6,view: 'text', type: 'string',},
  updateTime: {title: '更新时间',order: 7,view: 'datetime', type: 'string',},
};
